package by.bsu.touragency.db.beans;

import java.util.regex.Matcher;
import java.util.regex.Pattern;

public class City {

	private int id;
	private String cityName;
	private Country country;
	private String about;

	public City() {
		super();
	}

	public City(String cityName, Country country, String about) {
		super();
		this.cityName = cityName;
		this.country = country;
		this.about = about;

	}

	public int getId() {
		return id;
	}

	public void setId(int id) {
		this.id = id;
	}

	public String getCityName() {
		return cityName;
	}

	public void setCityName(String cityName) {
		this.cityName = cityName;
	}

	public Country getCountry() {
		return country;
	}

	public void setCountry(Country country) {
		this.country = country;
	}

	public String getAbout() {
		return about;
	}

	public void setAbout(String about) {
		this.about = about;
	}

	public boolean isValidCityName(String cityName) {
		if (cityName != "" & cityName != null && cityName.length() < 50) {
			Pattern p = Pattern.compile("([A-Z])*([a-z])+");
			Matcher m = p.matcher(cityName);
			setCityName(cityName);
			return m.matches();
		} else
			return false;
	}
}
